<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>课程介绍</title>
    <link rel="stylesheet" href="/lib/layui/css/layui.css">
    <link rel="stylesheet" href="/css/attend/m/common.css">
    <link rel="stylesheet" href="/lib/layui/layui/css/eleTree.css">
    <script src="/lib/layui/layui/layui.js"></script>
    <script type="text/javascript" src="/lib/layui/layui/global.js"></script>
    <script type="text/javascript" src="/js/jquery/jquery-1.9.1.js"></script>
    <script src="/js/base/base.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/layui/layui/js/common.js" type="text/javascript" charset="utf-8"></script>

    <style>
        html {
            background: #f2f2f2;
            color: #666;
        }
        .top{
            padding:10px;
            height:290px;
        }
        .imgCon{
            float: left;
            width: 550px;
            height: 290px;
        }
        .rightCon{
            float:left;
            width:calc(100% - 580px);
            margin-left:20px;
            text-align: left;
        }
        .courseName{
            font-size:24px;
            line-height: 45px;
        }
        .couseTitle{
            width:100%;
            height:50px;
            line-height: 50px;
            /*background: #f7f7f7;*/
            font-size: 16px;
            /*padding-left: 30px;*/
        }
        .list li{
            width:100%;
            height:50px;
            line-height: 50px;
            font-size: 16px;
            /*padding-left: 50px;*/
        }
        .list li:hover{
            background: #f7f7f7;
            cursor:pointer;
        }
        #back{
            vertical-align: bottom;
            margin-top: 87px;
        }
        #ping{
            width:100%;
            height:50px;
        }
        .cList li{
            width:100%;
            height:70px;
            border-bottom:1px solid #eee;
        }
        .cList li .time{
            float:right
        }
        .cList li .cName{
            margin-top:10px;
        }
        .courseContent{
            line-height: 50px;
        }
        .detail{
            /*float:right;*/
            margin-left: 41px;
        }
        .layui-table-page{
            display: none;
        }

    </style>

</head>
<body style="">
<div class="layui-card" style="text-align: center;margin: auto;padding: 10px;width:80%;margin-top: 20px;">
    <div class="top" style="background-color: #353239;">
        <img src="" alt="" class="imgCon" onerror="errorImg($(this))">
        <div class="rightCon">
            <div class="courseName" style="color: #FFFFF4;"></div>
            <div style="color: #98A4A2"><span id="course" style="margin-right: 30px;">线上课程</span><span id="sum1" style="display: none">学习人数：</span><span style="display: none" id="sum2">报名并已签到人数:</span><span id='personNum' style="color: red">666</span></div>
            <div style="color: #98A4A2;margin-top: 8px;">讲师: <span id="name"></span></div>
            <div id="study" style="color: #98A4A2;margin-top: 8px;display: none">要求学习时长：<span class="jieduan" style="color:red"></span>分钟<span style="    background: #98A4A2;
    width: 1px;
    height: 11px;
    margin: 0px 5px;
    display: inline-block;"></span>已学习时长<span class="study" style="color:red"></span>分钟</div>
            <%--<div style="color: #98A4A2">课程星级：<p id="ping" style="display: inline"></p></div>--%>
            <%--<div style="color: #98A4A2">综合评分: <span id="sumgrade"></span></div>--%>
            <div id="back">
                <button class="layui-btn layui-btn-lg layui-btn-danger" id="attend"  style="width: 140px;display: none">立即参加</button>
                <button class="layui-btn layui-btn-sm" lay-event="add" style="width: 70px" id="baks">返回</button>
                <button class="layui-btn layui-btn-sm"  style="width: 70px;display: none" id="baks1">返回</button>
            </div>
        </div>
    </div>

    <div class="layui-tab" lay-filter="tab" style="margin-top: 20px;">
        <%--<ul class="layui-tab-title">--%>
            <%--<li class="layui-this">课程介绍</li>--%>
            <%--<li id="content" >内容目录</li>--%>
            <%--<li id="studentEvaluation">学员评价</li>--%>
            <%--&lt;%&ndash;<li class="grades1">评分</li>&ndash;%&gt;--%>
        <%--</ul>--%>
        <div class="layui-tab-content" style="background-color: white">
            <h2 class="layui-colla-title"><span style="font-size: 16px;font-weight: bold;">课程介绍</span></h2>
            <div class="one" id="one" style="margin-top: 20px">

            </div>
            <h2 class="layui-colla-title" style="margin-top: 30px;margin-bottom: 20px"><span style="font-size: 16px;font-weight: bold;">内容目录</span></h2>
            <div class="" id="two">
                <div class="layui-card" id="courseCon">
                    <div id="con">

                    </div>
                    <div id="tables" class="layui-collapse" style="display: none">
                        <div class="layui-colla-item">
                            <h2 class="layui-colla-title"><span style="margin:0px 20px 0px 30px;">1</span><span style="margin:0px 12px ;">面授课程</span><span id="OfflineCourseName"></span></h2>
                            <div class="layui-colla-content layui-show">
                                <div style="width: 81%;margin: 0 auto;">
                                    <table id="contentDirectory" lay-filter="contentDirectory" ></table>
                                </div>

                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <h2 class="layui-colla-title student" style="margin-top: 30px;display: none;margin-bottom: 20px"><span style="font-size: 16px;font-weight: bold;">学员评价</span></h2>
            <div class="studentEvaluation" style="display: none">
                <div style="text-align:center;font-size:16px;display: none" class="export">
                    <button class="layui-btn layui-btn-sm"  style="width: 70px;float: right;" id="export">导出</button>
                </div>
                <ul class="cList" style="padding-top: 30px;">

                </ul>
                <div style="margin-top: 10px;">
                    <textarea name="desc" id="pingCon" placeholder="请输入评论内容" class="layui-textarea"></textarea>
                    <textarea name="" id="graded" oninput = "value=value.replace(/[^\d]/g,'')" maxlength="2" style="margin-top: 10px;min-height: 30px;height: 40px;display:none" placeholder="请输入评分(0-10)" class="layui-textarea"></textarea>
                    <div style="text-align: right;margin-top: 10px;"><button type="button" id="pinglun" class="layui-btn layui-btn-sm">评论</button></div>
                </div>
            </div>
            <%--<div class="layui-tab-item">--%>
                <%--<div style="margin-top: 10px;">--%>
                    <%--<input type="text" name="grade" id="grade" placeholder="请输入分数(0-100)" class="layui-input">--%>
                    <%--<div style="text-align: right;margin-top: 10px;"><button type="button" id="grades" class="layui-btn layui-btn-sm">确定</button></div>--%>
                <%--</div>--%>
            <%--</div>--%>
        </div>
    </div>
</div>

    <script type="text/html" id="barOperation">

    </script>
    <script type="text/javascript">
        //点击返回线上课程页面
        $('#baks').click(function(){
            window.location.href='/train/myCourse'
        })
        //点击返回线下课程页面
        $('#baks1').click(function(){
            window.location.href='/train/myCourse?type=1'
        })
        var id = $.GetRequest().id;
        var courseType = $.GetRequest().courseType; // 0线上 1线下
        //scheduleId
        var sId;


        //处理图片加载不出来时，设置该图片为默认图片
        /*  function errorImg(e){
         e.attr('src','/xs?AID=770&MODULE=train&COMPANY=xoa1016&YM=1911&ATTACHMENT_ID=1053325982&ATTACHMENT_NAME=');
         }*/
        getAvdGrade();
        //取文件后缀名
        function GetFileExt(filepath) {
            if (filepath != "") {
                var pos = "." + filepath.replace(/.+\./, "");
                return pos;
            }
        }
        // $.ajax({
        //     url:'/course/showChild',
        //     data:{courseId:id},
        //     type:'get',
        //     dataType:'json',
        //     success:function(res){
        //         var data = res.data;
        //
        //
        //     }
        // })

        function getGrade(){
            $.ajax({
                url:'/grade/userCourse',
                data:{courseId : $.GetRequest().id},
                success:function (res) {
                    var data=res.object;
                    $('#grade').val(data.grade);
                }
            })
        }

        function getAvdGrade(){
            $.ajax({
                url:'/grade/AvgGrade',
                data:{courseId : $.GetRequest().id},
                success:function (res) {
                    $('#sumgrade').text(res.object);
                }
            })
        }
        $(document).on('click','#grades',function(){
            var layers;
            layui.use(['layer'], function () {
                layers = layui.layer;
            })
            if(isNaN($('#grade').val())){
                layers.alert('请输入正确数值', {icon: 5}, function (index) {
                    layers.close(index);
                    return false;
                })
            }
            $.ajax({
                url:'/grade/gradeUpdate',
                data:{courseId : $.GetRequest().id,
                    grade:$('#grade').val()},
                success:function (res) {
                    //评分成功后，清空输入框值
                    $('#grade').val('')
                    $('#sumgrade').text(res.object);
                    layers.alert(res.msg,{icon:6},function (index) {
                        layer.close(index);
                    })
                }
            })

        })
        layui.use(['element','rate','layer','table'], function () {
            var $ = layui.jquery
                , element = layui.element
                ,layer = layui.layer
                , rate = layui.rate //Tab的切换功能，切换事件监听等，需要依赖element模块
                ,table = layui.table



        function cutOut(str) {
            if(str.charAt(str.length-1)=="*"){
                var arr = str.substring(0,str.length-1)
                return arr
            }
        }

        if(courseType==0){
//线上课程详情显示
            $.ajax({
                url:'/trCourse/showDetils',
                data:{courseId:id},
                type:'get',
                dataType:'json',
                success:function(res){
                    if(res.msg!='err'){
                        // $('#content').hide()
                        $('#tables').hide()
                        $('#con').show()
                        $('#course').html('线上课程')
                        $('#sum1').show()
                        $('#sum2').hide()
                        $('#study').show();
                        $('.student').hide()
                        $('.studentEvaluation').hide()
                        // $('#attend').show()
                        var data = res.object;
                        if(data.learningTime!=undefined){
                            $('.jieduan').html(data.learningTime)
                        }else{
                            $('.jieduan').html('0')
                        }
                        if(data.studyTime!=undefined){
                            $('.study').html(data.studyTime)
                        }else{
                            $('.study').html('0')
                        }
                        $('.imgCon').attr('src','/xs?'+data.attachmentList[0].attUrl)
                        $('#name').html(data.courseLecturer);
                        $('.courseName').html(data.courseName)
                        $('#one').html(data.courseIntroduce)
                        $('#personNum').html(data.personSum)
                        var str='';
                        var data2=data.attachmentList1

                        str += ' <div class="couseTitle"><span style="padding-left: 30px;">'+data.courseName+'</span></div>\n' +
                            '                    <ul class="list">'+function(){
                                var str2=''
                                for(var j=0;j<data.attachmentList1.length;j++){
                                    str2+='<li ><a style="color:#207BD6;padding-left: 50px; " href="javascript:;">'+cutOut(data.attachmentList1[j].name)+'</a><button class="layui-btn layui-btn-sm detail" attrurl="'+data.attachmentList1[j].attUrl+'" type="'+function(){
                                            if(GetFileExt(data.attachmentList1[j].attachName) == '.jpg' || GetFileExt(data.attachmentList1[j].attachName) == '.jpeg' || GetFileExt(data.attachmentList1[j].attachName) == '.png' || GetFileExt(data.attachmentList1[j].attachName) == '.PNG' || GetFileExt(data.attachmentList1[j].attachName) == '.JPG'||GetFileExt(data.attachmentList1[j].attachName) == '.pdf' || GetFileExt(data.attachmentList1[j].attachName) == '.PDF'){
                                                return 'playDiv';
                                            }else if(GetFileExt(data.attachmentList1[j].attachName) == '.mp4' || GetFileExt(data.attachmentList1[j].attachName) == '.rmvb' || GetFileExt(data.attachmentList1[j].attachName) == '.avi' || GetFileExt(data.attachmentList1[j].attachName) == '.ifo' || GetFileExt(data.attachmentList1[j].attachName) == '.wmv') {
                                                return 'player';
                                            }else if (GetFileExt(data.attachmentList1[j].attachName) == '.doc' || GetFileExt(data.attachmentList1[j].attachName) == '.docx' || GetFileExt(data.attachmentList1[j].attachName) == '.ppt' || GetFileExt(data.attachmentList1[j].attachName) == '.pptx' || GetFileExt(data.attachmentList1[j].attachName) == '.xls'|| GetFileExt(data.attachmentList1[j].attachName) == '.xlsx') {
                                                return 'seeDiv';
                                            }else {
                                                return 'downloadDiv';
                                            }
                                        }()+'"  style="width: 70px" >'+function(){
                                            if(GetFileExt(data.attachmentList1[j].attachName) == '.jpg' || GetFileExt(data.attachmentList1[j].attachName) == '.jpeg' || GetFileExt(data.attachmentList1[j].attachName) == '.png' || GetFileExt(data.attachmentList1[j].attachName) == '.PNG' || GetFileExt(data.attachmentList1[j].attachName) == '.JPG'||GetFileExt(data.attachmentList1[j].attachName) == '.pdf' || GetFileExt(data.attachmentList1[j].attachName) == '.PDF'){
                                                return '查看';
                                            }else if(GetFileExt(data.attachmentList1[j].attachName) == '.mp4' || GetFileExt(data.attachmentList1[j].attachName) == '.rmvb' || GetFileExt(data.attachmentList1[j].attachName) == '.avi' || GetFileExt(data.attachmentList1[j].attachName) == '.ifo' || GetFileExt(data.attachmentList1[j].attachName) == '.wmv') {
                                                return '查看';
                                            }else if(GetFileExt(data.attachmentList1[j].attachName) == '.doc' || GetFileExt(data.attachmentList1[j].attachName) == '.docx' || GetFileExt(data.attachmentList1[j].attachName) == '.ppt' || GetFileExt(data.attachmentList1[j].attachName) == '.pptx' || GetFileExt(data.attachmentList1[j].attachName) == '.xls'|| GetFileExt(data.attachmentList1[j].attachName) == '.xlsx') {
                                                return '查看';
                                            }else{
                                                return '下载';
                                            }
                                        }()+'</button></li>'
                                }
                                return str2;
                            }()+'</ul>'
                        if(data.videoAddress!=''&&data.videoAddress!=undefined){
                            str += ' <div class="couseTitle"><span style="padding-left: 30px;">视频课程</span></div>\n' +
                                '                    <ul class="list">'+function(){


                                    return '<li ><a style="color:#207BD6;padding-left: 50px; " href="javascript:;">视频内容</a><button class="layui-btn layui-btn-sm detail" attrurl="'+data.videoAddress+'" type="player" style="width: 70px" > 播放</button></li>'


                                }()+'</ul>'
                        }



                        $('#con').html(str)

                        var ins1 = rate.render({
                            elem: '#ping'  //绑定元素
                            ,value: data.star
                            ,readonly: true
                        });
                    }

                }
            })
        } else {
            //线下课程详情显示
            $.ajax({
                url:'/trCourseSchedule/selectByCouseId',
                data:{courseId:id},
                type:'get',
                dataType:'json',
                success:function(res){
                    if(res.msg!='err'){
                        $('#tables').show()
                        $('#baks').hide()
                        $('#baks1').show()
                        var data = res.object[0];
                        sId=data.scheduleId
                        pl()
                        getList()
                        // $('#content').show()
                        $('#course').html('线下课程')
                        $('#sum1').hide()
                        $('#sum2').show()
                        $('#study').hide();
                        $('.studentEvaluation').show()
                        $('.student').show()

                        var str2=' <div class="couseTitle"><span style="padding-left: 30px;">'+data.courseName+'</span></div>\n' +
                            '                    <ul class="list">';
                        for(var j=0;j<data.attachmentList1.length;j++){
                            str2+='<li ><a style="color:#207BD6;padding-left: 50px; " href="javascript:;">'+cutOut(data.attachmentList1[j].name)+'</a><button class="layui-btn layui-btn-sm detail" attrurl="'+data.attachmentList1[j].attUrl+'" type="'+function(){
                                    if(GetFileExt(data.attachmentList1[j].attachName) == '.jpg' || GetFileExt(data.attachmentList1[j].attachName) == '.jpeg' || GetFileExt(data.attachmentList1[j].attachName) == '.png' || GetFileExt(data.attachmentList1[j].attachName) == '.PNG' || GetFileExt(data.attachmentList1[j].attachName) == '.JPG'||GetFileExt(data.attachmentList1[j].attachName) == '.pdf' || GetFileExt(data.attachmentList1[j].attachName) == '.PDF'){
                                        return 'playDiv';
                                    }else if(GetFileExt(data.attachmentList1[j].attachName) == '.mp4' || GetFileExt(data.attachmentList1[j].attachName) == '.rmvb' || GetFileExt(data.attachmentList1[j].attachName) == '.avi' || GetFileExt(data.attachmentList1[j].attachName) == '.ifo' || GetFileExt(data.attachmentList1[j].attachName) == '.wmv') {
                                        return 'player';
                                    }else if (GetFileExt(data.attachmentList1[j].attachName) == '.doc' || GetFileExt(data.attachmentList1[j].attachName) == '.docx' || GetFileExt(data.attachmentList1[j].attachName) == '.ppt' || GetFileExt(data.attachmentList1[j].attachName) == '.pptx' || GetFileExt(data.attachmentList1[j].attachName) == '.xls'|| GetFileExt(data.attachmentList1[j].attachName) == '.xlsx') {
                                        return 'seeDiv';
                                    }else {
                                        return 'downloadDiv';
                                    }
                                }()+'"  style="width: 70px" >'+function(){
                                    if(GetFileExt(data.attachmentList1[j].attachName) == '.jpg' || GetFileExt(data.attachmentList1[j].attachName) == '.jpeg' || GetFileExt(data.attachmentList1[j].attachName) == '.png' || GetFileExt(data.attachmentList1[j].attachName) == '.PNG' || GetFileExt(data.attachmentList1[j].attachName) == '.JPG'||GetFileExt(data.attachmentList1[j].attachName) == '.pdf' || GetFileExt(data.attachmentList1[j].attachName) == '.PDF'){
                                        return '查看';
                                    }else if(GetFileExt(data.attachmentList1[j].attachName) == '.mp4' || GetFileExt(data.attachmentList1[j].attachName) == '.rmvb' || GetFileExt(data.attachmentList1[j].attachName) == '.avi' || GetFileExt(data.attachmentList1[j].attachName) == '.ifo' || GetFileExt(data.attachmentList1[j].attachName) == '.wmv') {
                                        return '查看';
                                    }else if(GetFileExt(data.attachmentList1[j].attachName) == '.doc' || GetFileExt(data.attachmentList1[j].attachName) == '.docx' || GetFileExt(data.attachmentList1[j].attachName) == '.ppt' || GetFileExt(data.attachmentList1[j].attachName) == '.pptx' || GetFileExt(data.attachmentList1[j].attachName) == '.xls'|| GetFileExt(data.attachmentList1[j].attachName) == '.xlsx') {
                                        return '查看';
                                    }else{
                                        return '下载';
                                    }
                                }()+'</button></li>'
                        }
                        str2+='</ul>'

                        $('#con').html(str2);
                        // $('.imgCon').attr('src','/xs?'+data.attachmentList[0].attUrl)
                        $('#name').html(data.courseLecturer);
                        $('.courseName').html(data.scheduleName)
                        $('#one').html(data.courseIntroduce)
                        $('#personNum').html(data.personNumber)
                        table.render({
                            elem: '#contentDirectory'
                            ,width: 800
                            ,url: '/trCourseSchedule/selectByCouseIdOnly'//数据接口
                            ,where: {courseId: $.GetRequest().id}
                            ,page: true //开启分页
                            ,cols: [[ //表头
                                {field: 'period', title: '期次',width:'20%', fixed: 'left',templet: function(d){
                                    return '第'+d.LAY_INDEX+'期'
                                }}
                                ,{field: 'courseTime', title: '上课时间',width:'40%',templet: function(d){
                                    return d.courseTime+'~'+d.courseTime1
                                }}
                                ,{field: 'courseAddress', title: '上课地点',}
                                ,{field: 'courseLecturer', title: '讲师',}
                            ]]
                            ,parseData: function(res){ //res 即为原始返回的数据
                                return {
                                    "code": 0, //解析接口状态
                                    "data": res.object //解析数据列表
                                };
                            }
                        });
                        $.ajax({
                            url:'/trCourseSchedule/selectByCouseId',
                            data:{courseId:id},
                            type:'get',
                            dataType:'json',
                            success:function(res){
                                var data = res.object[0];
                                $('#OfflineCourseName').html(data.scheduleName)


                            }
                        })
                    }

                    // var ins1 = rate.render({
                    //     elem: '#ping'  //绑定元素
                    //     ,value: data.star
                    //     ,readonly: true
                    // });
                }
            })
        }





            //内容目录
            $(document).ready(function(){
                // $("#content").on("click",function(){
                //
                // });
            });
            function detail(data){
                $.ajax({
                    url:'/trCourseSchedule/addtrStudyRecord',
                    type:'post',
                    data:data,
                    dataType:'json',
                    success:function(res){

                    }
                })
            }

            $('#courseCon').on('click','.detail',function(){

                var data={courseId:$.GetRequest().id}
                data.type=1;
                var type = $(this).attr('type');
                var path=$(this).attr('attrurl')
                var startTime=''
                var endTime = ''
                switch (type){
                    case 'playDiv':
                        data.type = 2;
                        detail(data)
                        window.open("/xs?"+path)
                        break;
                    case 'player':
                        data.type = 1;
                        startTime = new Date().Format('hh:mm:ss')
                        layer.open({
                            type: 1,
                            area:['900px','90%'],
                            title:'视频播放',
                            maxmin:true,
                            content: '<iframe allowfullscreen="true" frameborder="0" allowtransparency="true" style="width:100%;height:100%" src="'+path+'"></iframe>',
                            success:function(){
                                $('.layui-layer-close').click(function(){
                                    endTime = new Date().Format('hh:mm:ss')
                                    data.studyTimeSum = startTime
                                    data.studyTimeNew = endTime
                                    detail(data)
                                })
                            }
                        });
                        break;
                    case 'seeDiv':
                        data.type = 2;
                        detail(data);
                        preview($(this));
                        break;
                    case 'downloadDiv':
                        data.type = 2;
                        detail(data);
                        window.location.href='/download?'+path
                        break;

                }
            })
            function getList(){
                $.ajax({
                    url:'/trCourseManage/huixianPing',
                    data:{scheduleId:sId},
                    type:'get',
                    dataType:'json',
                    success:function(res){
                        var str=''
                        if(res.object!==undefined){
                            $('#pinglun').css('background-color','gainsboro').attr('disabled',true)
                            $('#pingCon').attr('readonly','readonly')
                            $('.export').css('display','block')
                            if(res.object.content==undefined){
                                var cont='';
                                str += ' <li>\n' +
                                    '                        <div class="courseContent">'+cont+'</div>\n' +
                                    '                    </li>'
                            }else {
                                str += ' <li>\n' +
                                    '                        <div class="courseContent">评价:'+res.object.content+'</div>\n' +
                                    '                    </li>'+
                                    ' <li style="border-bottom:none;margin-top: 10px;height: 20px;">\n' +
                                    '                        <div class="fraction">评分:'+res.object.fraction+'</div>\n' +
                                    '                    </li>'
                            }
                            // for(var i=0;i<res.object.length;i++){
                            //     str += ' <li>\n' +
                            //         // '                        <div class="cName">\n' +
                            //         // '                            <span class="names">'+res.object[i].evaluateUser+'</span>\n' +
                            //         // '                            <span class="time">'+res.object[i].evaluateTime+'</span>\n' +
                            //         // '                        </div>\n' +
                            //         '                        <div class="courseContent">'+res.object[i].content+'</div>\n' +
                            //         '                    </li>'
                            // }

                        }else{
                            $('#graded').show()
                            $('.export').css('display','none')
                            $('.cList').css('padding-top',0)
                            str='<div style="text-align:center;font-size:16px;"><i class="layui-icon layui-icon-tips" style="font-size: 30px; color: #1E9FFF;vertical-align: middle;"></i> 暂无评论</div>'


                        }
                        $('.cList').html(str)
                    }
                })
            }
            $('#export').click(function () {
                window.location.href='/trCourseManage/exportCommentAll?courseId='+$.GetRequest().id
            })
            function pl(){
                $('#pinglun').click(function(){
                    $.ajax({
                        url:'/trCourseManage/xianxiaPing',
                        data:{scheduleId:sId,content:$('#pingCon').val(),fraction:$('#graded').val()},
                        type:'get',
                        dataType:'json',
                        success:function(res){
                            console.log(res)
                            if(res.msg=='err'){
                                layer.msg('该课程还未学习，不能评论！', {icon: 5});
                            }
                            getList();
                            $('#pingCon').val('')
                        }
                    })
                })
            }


            element.on('tab(tab)', function (elem) {
                var index = elem.index;
                if(index == 2){
                    getList();
                }
                if(index==3){
                    getGrade();
                }
            });

            //点击 立即参加
            $('#attend').click(function(){
                $.ajax({
                    url:'/trCourse/addtrStudyRecord',
                    data:{courseId:id},
                    type:'post',
                    dataType:'json',
                    success:function(res){
                        if(res.msg=='true'){
                            layer.msg('参加成功！', {icon: 1});
                        }
                    }
                })
            })

        });
    </script>
</body>


</html>